package com.wzw.springboot.principle.lifecycle.bean;

import javax.annotation.PostConstruct;
import javax.annotation.PreDestroy;

/**
 * 使用 JSR250 注解方式实现bean对象的初始化
 * @author Wangzhiwen
 */
public class Bean3 {
    private int age;
    private String name;

    @PostConstruct
    public void init(){
        System.out.println("bean3 jsr250 @PostConstruct 初始化...........");
    }

    @PreDestroy
    public void destroy(){
        System.out.println("bean3 jsr250 @PreDestroy 销毁...........");
    }

    public int getAge() {
        return age;
    }

    public void setAge(int age) {
        this.age = age;
    }

    public String getName() {
        return name;
    }

    public void setName(String name) {
        this.name = name;
    }

    @Override
    public String toString() {
        return "Bean3{" +
                "age=" + age +
                ", name='" + name + '\'' +
                '}';
    }
}
